package top.zhangjianyong.tools.service.mybatis.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.zhangjianyong.tools.entity.Laji;
import top.zhangjianyong.tools.mapper.LajiMapper;
import top.zhangjianyong.tools.service.mybatis.ILajiService;

import java.util.List;

/**
 * @author ： zhangjianyong
 * @date ： 2023/3/15 10:52 AM
 */
@Service
public class ILajiServiceImpl extends ServiceImpl<LajiMapper, Laji> implements ILajiService {

    @Override
    public Laji qryByName(String name) {
        return lambdaQuery().eq(Laji::getName, name).one();
    }

    @Override
    public List<Laji> listHis(int limit) {
        return lambdaQuery().orderByDesc(Laji::getUpdateTime).last("limit " + limit).list();
    }
}
